<?php 
$adc->setViewObject('AdEdit');
if(is_file($adc->getViewPath().$adc->getViewObject().'.php'))
{ require($adc->getViewPath().$adc->getViewObject().'.php'); }
?>
<form id="<?php echo $com->Id; ?>_list_ad" action="" method="post" enctype="multipart/form-data" name="list_ad">
<input type="hidden" id="del_ad_id" name="del_ad_id" value="0" />
<input type="hidden" id="renew_ad_id" name="renew_ad_id" value="0" />
</form>
<script type="text/javascript">

$(function() {
	$('#delete_ad_dialog').dialog({
		autoOpen: false,
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery('#del_ad_id').val(0);
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($adc->formatTextASCI($txt->getWord('delete')).' '.$txt->getWord('ad')); ?>': function() 
			{
				//jQuery('#del_ad_id').val(itemId);
				jQuery(this).dialog('close');
				jQuery('#<?php echo $com->getId(); ?>_list_ad').submit();
			}
		}
	});

});
$(".deleteAdButton").click(function() { deleteAdDialog($(this).attr('rel')); /* $( "#dialog-form" ).dialog( "open" );*/ });

function deleteAdDialog(itemId)
{
	jQuery('#del_ad_id').val(itemId);
	jQuery('#delete_ad_dialog').dialog('open');
}
function renewAdDialog(itemId)
{
	jQuery('#renew_ad_dialog').dialog('open');
	jQuery('#renew_ad_dialog').dialog({
		bgiframe: true,
		resizable: false,
		height: 200,
		width: 400,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('renew')).' '.$txt->getWord('ad'); ?>': function() 
			{
				jQuery('#renew_ad_id').val(itemId);
				jQuery(this).dialog('close');
				jQuery('#<?php echo $com->getId(); ?>_list_ad').submit();
			}
		}
	});
}
</script>
<div id="delete_ad_dialog" title="<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('ad')); ?>?" style="display:none; text-align:left;">
	<p>
		<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
		<?php echo ucfirst($txt->getWord('sure_you_want_to_delete').' '.$txt->getWord('ad')); ?>
	</p>
</div>
<div id="renew_ad_dialog" title="<?php echo ucfirst($txt->getWord('renew').' '.$txt->getWord('ad')); ?>?" style="display:none; text-align:left;">
	<p>
		<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 10px 0;"></span>
		<?php echo ucfirst($txt->getWord('sure_you_want_to').' '.$txt->getWord('renew').' '.$txt->getWord('this_ad')); ?>?<br /><hr />
	</p>
	<p>
		<?php echo $adc->getSetting('RenewInfo'); ?>
	</p>
</div>
<div class="command-bar">
<?php 
$buttons[0]['title'] = ucfirst($txt->getWord('insert').' '.$txt->getWord('new_ad'));
$buttons[0]['href'] = '/c/'.$com->getComId().'/?edit=ad';
$buttons[0]['params']['class'] = 'default btn btn-primary';

$com->setButtonsContent($buttons);
unset($buttons);

echo getButtonsHTML($theme->HFBSets[$theme->ComHFB]['button'], $com->getButtonsContent()); 
?></div>